# -*- coding: utf-8 -*-
"""
Created on Mon Nov 30 20:02:03 2015

@author: liangrongli
"""
import re
def search_baidu_rank(site_url,keywords):
    import urllib
    from bs4 import BeautifulSoup
    url = "http://www.baidu.com/baidu?wd=%s&tn=monline_4_dg" % keywords
    html = urllib.urlopen(url)
    bs_obj = BeautifulSoup(html,"html.parser")
    #numstr = bs_obj.find(site_url)
    return bs_obj
    #return numstr

if __name__ == "__main__":

    #keywords = raw_input("please input needed keyword : ")
    keywords = u"PC/ABS"
    url0 = "kumhosunny.com"
    r = search_baidu_rank(url0,keywords)
    #r1 = r.find("title")
    #r1 = r.title.text
    r1 = r.findAll("span",{"class":"g"})
    print r1
    #print r1.strip()
    for i in r1:
        print i
#a = '<span class="g">www.kumhosunny.com/\xa0</span>'
#a.find("kumhosunny.com")
#keywords = u"锦湖日丽"
#url = "https://www.baidu.com/baidu?wd=%s&tn=monline_4_dg" % keywords
#print url